In Navigation Services 2.0 and later, you can block certain user navigation actions such as file opening and saving by passing the
kNavCtlSetActionState
constant in the selector parameter of the function and one or more of the values defined by the
NavActionState
enumeration (described in ) in the
parms
parameter. This is useful when you want to prevent a dialog box from being dismissed until certain conditions are met, for example.
The actions you can block include:
In the following example, the
kNavDontOpenState
constant is used to disable the Open button in an Open dialog box:
NavCustomControl( context, kNavCtlSetActionState, kNavDontOpenState );
In the next example, the
kNavDontChooseState
constant is used in addition to the
kNavDontOpenState
constant. During a call to the function, for example, this disables the Open and Choose buttons:
NavCustomControl( context, kNavCtlSetActionState, kNavDontOpenState + kNavDontChooseState);
In the final example, we add the
constant to disable the Open, Choose, and New Folder buttons during a call to the function:
kNavDontNewFolderState
NavCustomControl( context, kNavCtlSetActionState, kNavDontOpenState + kNavDontChooseState + kNavDontNewFolderState );
If you block a user action by passing one or more of the
NavActionState
constants, make sure you set the
kNavNormalState
constant before exiting in order to restore the default state. If you fail to set the
kNavNormalState
constant, the user may be unable to dismiss the dialog box.